package 单例模式.枚举;

/**
 * 推荐使用
 */
public class Singleton {
    public static void main(String[] args) {
        System.out.println(Singleton1.INSTANCE.hashCode());
        System.out.println(Singleton1.INSTANCE.hashCode());
        Singleton1.INSTANCE.sayOK();
    }
}
enum Singleton1{
    INSTANCE;
    public void sayOK(){
        System.out.println("HELLO");
    }
}